/// ---------------------------------------------
/// 用于部门选择
/// 江怀玉
/// 200
/// ---------------------------------------------
$(document).ready(function(){
$("body").append("<div id='upload_div' style='position:absolute; z-index:10001;bgcolor:#eee;width:300px;height:100px;border:solid 3px #ddd;display:none'></div>");
	$(document).click(function(event){
 	 });
});
$.fn.upload = function(options) {
    var defaults = {
        ipt: this,
        evt: "click"
    };
    if (options) {
        $.extend(defaults, options);
    }
    var e = defaults.evt;
    var obj = defaults.ipt;
    if (e == "click") $(this).click(showCar);
    if (e == "mouseover") $(this).mouseover(showCar);
    function showCar() {
        var iptId = $(obj).attr("id").replace('btn', '');
        carHtml(iptId);
        var tLeft = $(obj).offset().left;
        var tTop = $(obj).offset().top + 20;
        $("#upload_div").css({ display: "block", left: tLeft, top: tTop });
        //alert("");
        //window.setTimeout("", 100);
    }
    function carHtml(vipt) {
        var carArr = new Array();
        carArr.push('<iframe scrolling="no" frameborder="0"  src="../Extend/AjaxData/UploadFile.aspx?c=' + vipt + '" style="width:100%;height:100%;"></iframe>'+
        '<div style=""width:300px;height:10px""><a style="float:right" href="javascript:this.closeUpload_div();">确定</a></div>');
        var htmlStr = carArr.join("");
        $("#upload_div").html(htmlStr);
    }

    function onUpload(id, value) {
        $("#" + id).val(value);
    }
    function onUploadHide(id, value) {
        $("#" + id).val(value);
    }
    function closeUpload_div() {
        $("#upload_div").css("display", "none");
    }
}

